export type ReturnType<T> = { data: T, success: boolean, code?: number, message?: string }


interface BaseRequest {

}

export interface PageRequest {
    pageNum: string;
    pageSize: string;
}

export interface TelegramLoginRequest {
    initData: string;
}

export type TeamRequest = BaseRequest

export enum TeamLevel {
    one = 'g1',
    two = 'g2'
}
export interface TeamDetailRequest extends TeamRequest, PageRequest {
    genType: TeamLevel
}

export interface TonTransactionCheck {
    amount: string;
    detectorType: string;
}

export interface TonSendTransaction extends TonTransactionCheck {
    serialNo: string
    hash: string
    address: string
}


export interface WithDraw {
    address: string;
    amount: string;
    comment: string;
    hash: string;
}

// ======================= Response ===========================
interface UserLogin {
    balance: string;
    balanceTon: string;
    id: number;
    image: string;
    username?: string;
    nickName: string;
    parentName: string;
    parentUserName?: string;
    inviteUrl?: string
}
export interface UserResponse extends UserLogin {
    token?: string;
    authDate?: number;
}

export enum DetState {
    working = '1',
    stop = '0'
}

export type Detector = {
    cycleLength: string,
    cycleLevel: string,
    detLevel: string,
    detPower: string,
    speedLevel: string,
    speedRate: string,
    detTonAmplify: string;
    detTonAmplifyUrl: string;

    readonly realDetPower: number;
}

export interface HomeResponse {
    balance: string,
    detState: DetState,
    detector: Detector,
    endTime: number,
    startTime: number,
    sysTime: number
}

export interface PageResponse<T> {
    size: number;
    total: number;
    list: T[]
}

export interface TeamResponse {
    inviteG1Num: number;
    inviteG1OnlineNum: number;
    inviteG1Tol: string;
    inviteG1TolTon: string;
    inviteG2Num: number;
    inviteG2OnlineNum: number;
    inviteG2Tol: string;
    inviteG2TolTon: string;
    inviteeNikeName: string;
    inviteUrl: string;
}

export interface TeamDetailResponse {
    detState: number;
    image: string;
    inviteNum: number;
    nikeName: string;
    userName: string;
    userId: string;
    parent1Name: string;
    rewardAmt: string;
    rewardAmtTon: string;
}

export enum TaskTypes {
    Community = '1',
    Invite = '2',
    Other = '3'
}
export interface Task {
    rewardAmt: string;
    takeSate: string;
    taskId: number;
    taskName: string;
    taskType: TaskTypes;
    icon: string;
    url: string;

    progressMax: number;
    progressValue: number;

    status: number;
}

export interface TaskResponse {
    taskList: Array<Task>;
    taskTypes: TaskTypes;
}

export enum RewardType {
    Invite = 'invite',
    BeInvite = 'beInvite',
    InviteRank = 'inviteRank',
    PoolReward = 'poolReward'
}

export interface Reword {
    beInviteReward: string;
    parentName: string;
    inviteCount: string;
    inviteReward: string;
    inviteRewardTon: string;
    inviteRankReward: string;
    prompt: string; // msg if no reword
}


export type UpgradeValue = {
    currValue: string;
    level: string;
    upgradeCost: string;
}
export interface UpgradeInfo {
    detector: UpgradeValue[];
    speed: UpgradeValue[];
    station: UpgradeValue[];
    userDetector: Detector;
    robot: string;

}

export interface RankingInfo {
    image: string | null;
    nickName: string | null;
    num: number;
    serNo: number,
    reward?: string
}

export interface RankingResponse {
    self: RankingInfo;
    snapTime: string;
    items: RankingInfo[]
}

export interface WalletInfo extends UserLogin { }

export enum PurchaseStatus {
    None = '0',
    Purchase = '1',
    Upgrade = '2',
    Purchased = '3'
}

export enum PurchaseConfirm {
    Pendding = '0',
    Done = '1'
}
export interface DetectorTypeInfo {
    costAmount: string
    currency: string
    days: string
    addDays: string
    detectorType: string
    imageUrl: string
    leftDays: string
    purchaseAmount: string
    purchaseConfirm: PurchaseConfirm
    purchaseStatus: PurchaseStatus
    speed: string
    title: string
}

export interface TonTransactionInfo {
    address: string;
    comment: string;
    serialNo: string
}

export interface WithDrawRecord {
    time: string;
    currency: string;
    amount: string;
    address: string;
    statusRemark: string
}

export interface WithDrawInfo {
    chain: string;
    currency: string;
    fee: string;
    available: string;
    min: string;
    total: string;
}

export enum PrizeStatus {
    None = '0',
    Wait = '1', // Prizes to be claimed
    Done = '2', // The prize has been claimed
}
export interface PrizeInfo {
    poolTon: string;
    poolEarth: string;
    value: string; // current invited
    max: string; // task need invite
    rewardTon: string;
    rewardEarth: string;
    status: PrizeStatus;
    inviteUrl: string;
}